/**
 * 类型定义导出文件
 * 
 * 集中导出所有类型定义，便于其他模块导入使用
 */

// 导出组件相关类型
export * from './component';

// 导出模型相关类型（除了可能冲突的类型）
export * from './model';

// 导出页面类型和布局类型作为值
export { PageType, LayoutType } from './page';

// 导出页面和应用相关类型（使用具名导出避免冲突）
export type {
  Page,
  PageMetadata,
  PagePermission
} from './page';

export type {
  ThemeConfig,
  App,
  AppConfig,
  AppData,
  GenerationConfig
} from './app';

// 显式处理命名冲突
export type { NavigationConfig as AppNavigationConfig } from './app';
export type { NavigationConfig as PageNavigationConfig } from './page';
export type { Model } from './model';

// 为了兼容性，添加别名
export type { Page as PageDefinition } from './page';
export type { App as AppDefinition } from './app';
export type { Model as ModelDefinition } from './model';

/**
 * 定义状态操作类型
 */
// 使用字符串字面量类型代替enum
export type ActionType = 
  // 页面操作
  | 'ADD_PAGE'
  | 'UPDATE_PAGE'
  | 'REMOVE_PAGE'
  | 'SET_CURRENT_PAGE'
  
  // 组件操作
  | 'ADD_COMPONENT'
  | 'UPDATE_COMPONENT'
  | 'REMOVE_COMPONENT'
  | 'UPDATE_COMPONENT_PROPS'
  | 'UPDATE_COMPONENT_LAYOUT'
  | 'SELECT_COMPONENT'
  
  // 模型操作
  | 'ADD_MODEL'
  | 'UPDATE_MODEL'
  | 'REMOVE_MODEL'
  
  // 撤销重做
  | 'UNDO'
  | 'REDO'
  
  // 应用模板
  | 'APPLY_TEMPLATE'
  
  // 应用设置
  | 'UPDATE_APP_CONFIG';

// 创建ActionType枚举对象
export const ActionType = {
  // 页面操作
  ADD_PAGE: 'ADD_PAGE' as ActionType,
  UPDATE_PAGE: 'UPDATE_PAGE' as ActionType,
  REMOVE_PAGE: 'REMOVE_PAGE' as ActionType,
  SET_CURRENT_PAGE: 'SET_CURRENT_PAGE' as ActionType,
  
  // 组件操作
  ADD_COMPONENT: 'ADD_COMPONENT' as ActionType,
  UPDATE_COMPONENT: 'UPDATE_COMPONENT' as ActionType,
  REMOVE_COMPONENT: 'REMOVE_COMPONENT' as ActionType,
  UPDATE_COMPONENT_PROPS: 'UPDATE_COMPONENT_PROPS' as ActionType,
  UPDATE_COMPONENT_LAYOUT: 'UPDATE_COMPONENT_LAYOUT' as ActionType,
  SELECT_COMPONENT: 'SELECT_COMPONENT' as ActionType,
  
  // 模型操作
  ADD_MODEL: 'ADD_MODEL' as ActionType,
  UPDATE_MODEL: 'UPDATE_MODEL' as ActionType,
  REMOVE_MODEL: 'REMOVE_MODEL' as ActionType,
  
  // 撤销重做
  UNDO: 'UNDO' as ActionType,
  REDO: 'REDO' as ActionType,
  
  // 应用模板
  APPLY_TEMPLATE: 'APPLY_TEMPLATE' as ActionType,
  
  // 应用设置
  UPDATE_APP_CONFIG: 'UPDATE_APP_CONFIG' as ActionType
};

// 历史记录接口
export interface HistoryItem {
  actionType: ActionType;
  payload: unknown;
  timestamp: number;
}

// 应用历史状态
export interface AppHistory {
  past: HistoryItem[];
  future: HistoryItem[];
} 